//
//  TradingProcessView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/18.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "TradingProcessView.h"
#import <Masonry.h>
@implementation TradingProcessView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"POS" ofType:@"gif"];
    NSData *gifData = [NSData dataWithContentsOfFile:path];
    self.webView = [[UIWebView alloc] init];
    self.webView.scalesPageToFit = YES;
    [self.webView loadData:gifData MIMEType:@"image/gif" textEncodingName:@"" baseURL:[NSURL URLWithString:@""]];
    self.webView.backgroundColor = [UIColor clearColor];
    self.webView.opaque = NO;
    self.webView.userInteractionEnabled = NO;
//    self.webView.backgroundColor = [UIColor orangeColor];
    [self addSubview:self.webView];
    [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(80);
        make.centerX.equalTo(self);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(150);
    }];
    
    self.searchLab = [[UILabel alloc] init];
    self.searchLab.text = @"正在搜索POS机";
    self.searchLab.font = [UIFont boldSystemFontOfSize:18];
    self.searchLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    [self addSubview:self.searchLab];
    [self.searchLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.webView.mas_bottom).offset(26);
        make.centerX.equalTo(self);
    }];
    
    self.tipsLab = [[UILabel alloc] init];
    self.tipsLab.text = @"请确认POS机电源已打开";
    self.tipsLab.font = [UIFont systemFontOfSize:14];
    self.tipsLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self addSubview:self.tipsLab];
    [self.tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.searchLab.mas_bottom).offset(10);
        make.centerX.equalTo(self);
    }];
    
    self.getPosBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.getPosBtn setTitle:@"没有POS机? 快来领取" forState:(UIControlStateNormal)];
    [self.getPosBtn setTitleColor:[UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    self.getPosBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.getPosBtn];
    [self.getPosBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self).offset(-8);
        make.bottom.equalTo(self.mas_bottom).offset(-50);
    }];
    
    self.arrowImv = [[UIImageView alloc] init];
    self.arrowImv.image = [UIImage imageNamed:@"542"];
    [self addSubview:self.arrowImv];
    [self.arrowImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.getPosBtn.mas_right);
        make.centerY.equalTo(self.getPosBtn);
        make.width.mas_equalTo(16);
        make.height.mas_equalTo(16);
    }];
    
    
    
    
}

@end
